<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <%@ include file="/commons/basejs.jsp" %>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>优惠券管理</title>
    <script src="../../../static/easyui/plugins/datagrid.show.js" type="text/javascript"></script>
</head>
<body>
<div class="easyui-layout" fit="true" >
    <div data-options="region:'west',split:true,border:false" title="优惠券列表" style="width:50%;">
        <table id="coupon_datagrid" class="easyui-datagrid"
               data-options="
		   		url:'${root}/coupon/coupondg.do',
		   		fit:true,
		   		rownumbers:true,
		   		fitColumns:true,
		   		toolbar:'#coupondg_tools',
		   		pagination:true,
		   		singleSelect:true,
             onClickRow:function(index, row){
		   			rowchange(row.id);
		   		}">
            <thead>
            <th data-options="field:'id'">ID</th>
            <th data-options="field:'name',width:50">名称</th>
            <th data-options="field:'intor',width:80" hidden>描述</th>
            <th data-options="field:'providerType',width:40,formatter:
            function(value){if(value) return '平台';return '商家'}">提供者</th>
            <th data-options="field:'type',width:40,formatter:
            function(value){if(value==1) return '满折';
            if(value==2)return '现金';
            return '满减'}">优惠类型</th>
            <th data-options="field:'subtractionMoney',width:40">满减限额</th>
            <th data-options="field:'money',width:40">满减/现金金额</th>
            <th data-options="field:'discount',width:40">折扣</th>
            <th data-options="field:'maxDiscountMoney',width:40">最多折扣金额</th>
            <th data-options="field:'repertory',width:40">库存</th>
            <th data-options="field:'remainRepertory',width:40">剩余库存</th>
            <th data-options="field:'platform',width:40,formatter:
            function(value){if(value==1) return '全平台';
            if(value==2)return 'APP';
            if(value==3)return '手机wap';
            if(value==4)return 'PC';
            return '小程序'}">平台</th>
            <th data-options="field:'system',width:40,formatter:
            function(value){if(value==1) return '祺云';return '农信'}">支持系统</th>
            <th data-options="field:'startTime',width:80,formatter:formatDateBoxFull">开始时间</th>
            <th data-options="field:'endTime',width:80,formatter:formatDateBoxFull">结束时间</th>
            <th data-options="field:'createTime',width:80,formatter:formatDateBoxFull" hidden>创建时间</th>
            <th data-options="field:'updateTime',width:80,formatter:formatDateBoxFull" hidden>修改时间</th>
            </thead>
        </table>
        <div id="coupondg_tools">
            <shiro:hasPermission name="/coupon/add.do">
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="openEditBox('add')">添加</a>
            </shiro:hasPermission>
            <shiro:hasPermission name="/coupon/edit.do">
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit'" onclick="openEditBox('update')">修改</a>
            </shiro:hasPermission>
            <shiro:hasPermission name="/coupon/del.do">
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" onclick="deleteCoupon()" >删除</a>
            </shiro:hasPermission>
            <select id="settleStatus" style="width:80px;height:24px;position: relative;top: 3px;border-radius: 3px;" onchange="comboxchange()">
                <option value="">优惠类型</option>
                <option value="0">满减</option>
                <option value="1">折扣</option>
                <option value="2">现金</option>
            </select>
            <div id="date" style="display: inline">
                开始时间:<input id="begin"  class="Wdate"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
                结束时间:<input id="end"  class="Wdate"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
            </div>
            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="selectCoupon()">查询</a>
            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onclick="refconsumeDg()">重置</a>
        </div>
    </div>
    <div data-options="region:'center',split:true,border:false" title="" style="width:50%;">
        <div class="easyui-layout" fit="true" id="filsPanel">
            <div data-options="region:'west',split:true,border:true" title="" style="width:33%;">
                <div class="easyui-layout" fit="true">
                    <div data-options="region:'center',split:true,border:false" title="适用分类" style="height:50%;">
                        <table id="category_datagrid" class="easyui-datagrid"
                               data-options="
                        url:'${path}/coupon/category.do',
                        fit:true,
                        toolbar:'#category_tools',
                        rownumbers:true,
                        fitColumns: true,
                        pagination:true,
                        singleSelect:true">
                            <thead>
                            <th data-options="field:'id'">ID</th>
                            <th data-options="field:'name',width:100">分类名称</th>
                            <th data-options="field:'action',formatter:editAction"></th>
                            </thead>
                        </table>
                        <div id="category_tools">
                            <select  style="width:80px;height:24px;position: relative;border-radius: 3px;" onchange="comboxSelect(this.value,'category_datagrid')">
                                <option value="1">已选择</option>
                                <option value="2">未选择</option>
                            </select>
                        </div>
                    </div>
                    <div data-options="region:'south',split:true,border:false" title="排除分类" style="height:50%;">
                        <table id="discategory_datagrid" class="easyui-datagrid"
                               data-options="
                        url:'${path}/coupon/discategory.do',
                        fit:true,
                        toolbar:'#discategory_tools',
                        rownumbers:true,
                        fitColumns: true,
                        pagination:true,
                        singleSelect:true">
                            <thead>
                            <th data-options="field:'id'">ID</th>
                            <th data-options="field:'name',width:100">分类名称</th>
                            <th data-options="field:'action',formatter:editAction"></th>
                            </thead>
                        </table>
                        <div id="discategory_tools">
                            <select  style="width:80px;height:24px;position: relative;border-radius: 3px;" onchange="comboxSelect(this.value,'discategory_datagrid')">
                                <option value="1">已选择</option>
                                <option value="2">未选择</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div data-options="region:'center',split:true,border:false" title="" style="width:33%;">
                <div class="easyui-layout" fit="true">
                    <div data-options="region:'center',split:true,border:false" title="适用商家" style="height:50%;">
                        <table id="Seller_datagrid" class="easyui-datagrid"
                               data-options="
                        url:'${path}/coupon/seller.do',
                        toolbar:'#Seller_tools',
                        fit:true,
                        rownumbers:true,
                        fitColumns: true,
                        pagination:true,
                        singleSelect:true">
                            <thead>
                            <th data-options="field:'id'">ID</th>
                            <th data-options="field:'name',width:100">商家名称</th>
                            <th data-options="field:'action',formatter:editAction"></th>
                            </thead>
                        </table>
                        <div id="Seller_tools">
                            <select  style="width:80px;height:24px;position: relative;border-radius: 3px;" onchange="comboxSelect(this.value,'Seller_datagrid')">
                                <option value="1">已选择</option>
                                <option value="2">未选择</option>
                            </select>
                            <input class="easyui-searchbox" data-options="prompt:'请输入商家名称',searcher:Searchproduct" style="width:220px;"/>
                        </div>
                    </div>
                    <div data-options="region:'south',split:true,border:false" title="排除商家" style="height:50%;">
                        <table id="disSeller_datagrid" class="easyui-datagrid"
                               data-options="
                        url:'${path}/coupon/disseller.do',
                        toolbar:'#disSeller_tools',
                        fit:true,
                        rownumbers:true,
                        fitColumns: true,
                        pagination:true,
                        singleSelect:true">
                            <thead>
                            <th data-options="field:'id'">ID</th>
                            <th data-options="field:'name',width:100">商家名称</th>
                            <th data-options="field:'action',formatter:editAction"></th>
                            </thead>
                        </table>
                        <div id="disSeller_tools">
                            <select  style="width:80px;height:24px;position: relative;border-radius: 3px;" onchange="comboxSelect(this.value,'disSeller_datagrid')">
                                <option value="1">已选择</option>
                                <option value="2">未选择</option>
                            </select>
                            <input class="easyui-searchbox" data-options="prompt:'请输入商家名称',searcher:Searchproduct" style="width:220px;"/>
                        </div>
                    </div>
                </div>
            </div>
            <div data-options="region:'east',split:true,border:false" title="" style="width:34%;">
                <div class="easyui-layout" fit="true">
                    <div data-options="region:'center',split:true,border:false" title="适用产品" style="height:50%;">
                        <table id="Product_datagrid" class="easyui-datagrid"
                               data-options="
                        url:'${path}/coupon/product.do',
                        toolbar:'#Product_tools',
                        fit:true,
                        rownumbers:true,
                        fitColumns: true,
                        pagination:true,
                        singleSelect:true">
                            <thead>
                            <th data-options="field:'id'">ID</th>
                            <th data-options="field:'name',width:100">产品名称</th>
                            <th data-options="field:'action',formatter:editAction"></th>
                            </thead>
                        </table>
                        <div id="Product_tools">
                            <select  style="width:80px;height:24px;position: relative;border-radius: 3px;" onchange="comboxSelect(this.value,'Product_datagrid')">
                                <option value="1">已选择</option>
                                <option value="2">未选择</option>
                            </select>
                            <input class="easyui-searchbox" data-options="prompt:'请输入产品名称',searcher:Searchproduct" style="width:220px;"/>
                        </div>
                    </div>
                    <div data-options="region:'south',split:true,border:false" title="排除产品" style="height:50%;">
                        <table id="disProduct_datagrid" class="easyui-datagrid"
                               data-options="
                        url:'${path}/coupon/disproduct.do',
                        toolbar:'#disProduct_tools',
                        fit:true,
                        rownumbers:true,
                        fitColumns: true,
                        pagination:true,
                        singleSelect:true">
                            <thead>
                            <th data-options="field:'id'">ID</th>
                            <th data-options="field:'name',width:100">产品名称</th>
                            <th data-options="field:'action',formatter:editAction"></th>
                            </thead>
                        </table>
                        <div id="disProduct_tools">
                            <select  style="width:80px;height:24px;position: relative;border-radius: 3px;" onchange="comboxSelect(this.value,'disProduct_datagrid')">
                                <option value="1">已选择</option>
                                <option value="2">未选择</option>
                            </select>
                            <input class="easyui-searchbox" data-options="prompt:'请输入产品名称',searcher:Searchproduct" style="width:220px;"/>
                        </div>
                    </div>
                </div>
                </div>
        </div>
    </div>
</div>
<!--添加或修改优惠券-->
<jsp:include page="addOreditCoupon.jsp"/>
</body>
</html>